package com.wxapp.common.constant.pojo.vm;
import com.wxapp.common.constant.enums.ResultEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVm<T> implements Serializable {
    private Integer code;
    private String msg;
    private T data;

    public ResultVm(T data) {
        this.data = data;
    }

    public ResultVm<T> setCode(Integer code) {
        this.code = code;
        return this;
    }

    public ResultVm<T> setCodeEnum(ResultEnum resultEnum) {
        this.code = resultEnum.getValue();
        return this;
    }

    public ResultVm<T> setMsg(ResultEnum resultEnum) {
        this.msg = resultEnum.getDesc();
        return this;
    }

    public ResultVm<T> setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public ResultVm<T> setData(T data) {
        this.data = data;
        return this;
    }
}
